ORIFICE_DISCHARGE_C
Overview
Calculate the discharge coefficient for an orifice plate using the Reader-Harris-Gallagher correlation (ISO 5167 standard).
Excel Usage
=ORIFICE_DISCHARGE_C(pipe_diameter, orifice_diameter, density, viscosity, mass_flow_rate, orifice_taps)
pipe_diameter(float, required): Upstream internal pipe diameter (m)orifice_diameter(float, required): Diameter of orifice at flow conditions (m)density(float, required): Density of fluid (kg/m³)viscosity(float, required): Viscosity of fluid (Pa·s)mass_flow_rate(float, required): Mass flow rate of fluid through the orifice (kg/s)orifice_taps(str, optional, default: “corner”): Orientation of the pressure taps
Returns (float): Coefficient of discharge of the orifice plate, dimensionless [-]
Examples
Example 1: Standard orifice with flange taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.07391 | 0.0222 | 1.165 | 0.0000185 | 0.12 | flange |
Excel formula:
=ORIFICE_DISCHARGE_C(0.07391, 0.0222, 1.165, 0.0000185, 0.12, "flange")
Expected output:
| Result |
|---|
| 0.599 |
Example 2: Orifice with corner taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.07391 | 0.0222 | 1.165 | 0.0000185 | 0.12 | corner |
Excel formula:
=ORIFICE_DISCHARGE_C(0.07391, 0.0222, 1.165, 0.0000185, 0.12, "corner")
Expected output:
| Result |
|---|
| 0.6 |
Example 3: Orifice with D taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.1 | 0.05 | 998.2 | 0.001 | 5 | D |
Excel formula:
=ORIFICE_DISCHARGE_C(0.1, 0.05, 998.2, 0.001, 5, "D")
Expected output:
| Result |
|---|
| 0.6074 |
Example 4: Orifice with D/2 taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.1 | 0.05 | 998.2 | 0.001 | 5 | D/2 |
Excel formula:
=ORIFICE_DISCHARGE_C(0.1, 0.05, 998.2, 0.001, 5, "D/2")
Expected output:
| Result |
|---|
| 0.6074 |
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.flow_meter import C_Reader_Harris_Gallagher as fluids_c_reader_harris_gallagher
def orifice_discharge_c(pipe_diameter, orifice_diameter, density, viscosity, mass_flow_rate, orifice_taps='corner'):
"""
Calculate the discharge coefficient for an orifice plate using the Reader-Harris-Gallagher correlation (ISO 5167 standard).
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.C_Reader_Harris_Gallagher
This example function is provided as-is without any representation of accuracy.
Args:
pipe_diameter (float): Upstream internal pipe diameter (m)
orifice_diameter (float): Diameter of orifice at flow conditions (m)
density (float): Density of fluid (kg/m³)
viscosity (float): Viscosity of fluid (Pa·s)
mass_flow_rate (float): Mass flow rate of fluid through the orifice (kg/s)
orifice_taps (str, optional): Orientation of the pressure taps Valid options: Corner, Flange, D, D/2. Default is 'corner'.
Returns:
float: Coefficient of discharge of the orifice plate, dimensionless [-]
"""
try:
pipe_diameter = float(pipe_diameter)
orifice_diameter = float(orifice_diameter)
density = float(density)
viscosity = float(viscosity)
mass_flow_rate = float(mass_flow_rate)
except (TypeError, ValueError):
return "Error: All numeric parameters must be valid numbers."
if pipe_diameter <= 0:
return "Error: Pipe_diameter must be positive."
if orifice_diameter <= 0:
return "Error: Orifice_diameter must be positive."
if orifice_diameter >= pipe_diameter:
return "Error: Orifice_diameter must be less than pipe_diameter."
if density <= 0:
return "Error: Density must be positive."
if viscosity <= 0:
return "Error: Viscosity must be positive."
if mass_flow_rate <= 0:
return "Error: Mass_flow_rate must be positive."
try:
result = fluids_c_reader_harris_gallagher(
D=pipe_diameter,
Do=orifice_diameter,
rho=density,
mu=viscosity,
m=mass_flow_rate,
taps=orifice_taps
)
return float(result)
except Exception as e:
return f"Calculation error: {str(e)}"